#!/usr/bin/env python
# coding: utf-8

from datetime import datetime
import txmongo
from txmongo.dbref import DBRef

from twisted.internet import defer, reactor
 
@defer.inlineCallbacks
def example():
    mongo = yield txmongo.MongoConnection()

    db = mongo.ide  #  database
    sections = db.sections
    nodes = db.nodes

    s_google = yield nodes.find_one({'name':'goolge'})
    if s_google:
        s_google['name'] = 'google'
        s_google['title'] = 'Google'
        yield nodes.save(s_google, True)
        print 'ok'


if __name__ == '__main__':
    example().addCallback(lambda ign: reactor.stop())
    reactor.run()